사이트 내 전체검색
이미지 클릭하면 새창으로 크기에 맞게 이미지 띄우기
https://cmd.kr/javascript/259 URL이 복사되었습니다.

본문

--------------------------------------------------------------------------
<head>와</head>사이에 넣으세요.
--------------------------------------------------------------------------
<script language="JavaScript">
<!--
var win1Open = null

function displayImage(picName, windowName, windowWidth, windowHeight){
return window.open(picName,windowName,"toolbar=no,scrollbars=no,resizable=no,width=" + (parseInt(windowWidth)+20) + ",height=" + (parseInt(windowHeight)+15))
}

function winClose(){
if(win1Open != null) win1Open.close()
}

function doNothing(){}
//-->
</script>

<script language="JavaScript1.1">
<!--
function displayImage(picName, windowName, windowWidth, windowHeight){
var winHandle = window.open("" ,windowName,"toolbar=no,scrollbars=no,resizable=no,width=" + windowWidth + ",height=" + windowHeight)
if(winHandle != null){
var htmlString = "<html><head><title>Picture</title></head>"
htmlString += "<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>"
htmlString += "<a href=javascript:window.close()><img src=" + picName + " border=0 alt=닫기></a>"
htmlString += "</body></html>"
winHandle.document.open()
winHandle.document.write(htmlString)
winHandle.document.close()
}
if(winHandle != null) winHandle.focus()
return winHandle
}
//-->
</script>

-----------------------------------------------------------------
<body>와</body>사이에 넣으세요.
-----------------------------------------------------------------
<a href="javascript:doNothing()" onClick="win1Open=displayImage('이미지주소1', 'popWin1', '370', '529')" onMouseOver="window.status='Click to display picture'; return true;" onMouseOut="window.status=''"><img src="이미지주소1" border="0"></a>

<a href="javascript:doNothing()" onClick="win1Open=displayImage('이미지주소2', 'popWin1', '370', '531')" onMouseOver="window.status='Click to display picture'; return true;" onMouseOut="window.status=''"><img src="이미지주소2" border="0"></a>

<a href="javascript:doNothing()" onClick="win1Open=displayImage('이미지주소3', 'popWin1', '500', '375')" onMouseOver="window.status='Click to display picture'; return true;" onMouseOut="window.status=''"><img src="이미지주소3" border="0"></a>


설명)"이미지주소1"을 클릭하면 "이미지주소1"가 가로 370, 세로 529 크기의 새 창으로 뜹니다. 이 때 370 과 529는 각각 "이미지주소1"의 가로 세로 픽셀값과 맞추면 됩니다.

계속해서 이미지 추가해 사용할 수 있습니다.

출처 : http://www.aircon1004.com/data/bbs/board.php?bo_table=pds1&wr_id=71

댓글목록

등록된 댓글이 없습니다.

831 (9/17P)

Search

Copyright © Cmd 명령어 3.143.214.56